﻿<%@ Page Language="C#" MasterPageFile="~/Main.master" CodeBehind="Edit.aspx.cs" Inherits="DD_Extensions.Edit" %>


<asp:Content ID="headContent" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
        <DataControls>
            <asp:DataControlReference ControlID="FormView1" />
        </DataControls>
    </asp:DynamicDataManager>

    <h2 class="DDSubHeader">Edit <%= table.DisplayName %></h2>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true"
                HeaderText="List of validation errors" CssClass="DDValidator" />
            <asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="FormView1" Display="None" CssClass="DDValidator" />

            <asp:FormView 
                runat="server" 
                ID="FormView1" 
                DataSourceID="DetailsDataSource" 
                DefaultMode="Edit" 
                OnItemCommand="FormView1_ItemCommand" 
                OnItemUpdated="FormView1_ItemUpdated" 
                RenderOuterTable="false">
                <EditItemTemplate>
                    <table id="detailsTable" class="DDDetailsTable" cellpadding="0">
                        <asp:DynamicEntity runat="server" Mode="Edit" />
                        <tr class="td">
                            <td colspan="2" class="CommandCell">
                                <%--<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/DynamicData/Content/Images/Save.png" CommandName="Update"  />&nbsp;
                                <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/DynamicData/Content/Images/Cancel.png" CommandName="Cancel"  CausesValidation="false" />--%>
                                <asp:LinkButton ID="UpdateButton" runat="server" CssClass="DDControl" Text="Save" CommandName="Update" />
                                <asp:LinkButton ID="CancelButton" runat="server" CssClass="DDControl" Text="Cancel" CommandName="Cancel" CausesValidation="false" ToolTip="Cancel Edit" />
                            </td>
                        </tr>
                    </table>
                </EditItemTemplate>
                <EmptyDataTemplate>
                    <div class="DDNoItem">No such item.</div>
                </EmptyDataTemplate>
            </asp:FormView>

            <asp:EntityDataSource ID="DetailsDataSource" runat="server" EnableUpdate="true" 
                onupdated="DetailsDataSource_Updated" />

            <asp:QueryExtender TargetControlID="DetailsDataSource" ID="DetailsQueryExtender" runat="server">
                <asp:DynamicRouteExpression />
            </asp:QueryExtender>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

